#!/usr/bin/perl
#Author: Ian McCown
#Apache Log Project part 6

use MIME::Base64;

$log = $ARGV[0];
%users = ();

open FILE, "<", $log or die "log not found";
while (<FILE>) {
	$_ =~ /Authorization: Basic /;
#	print "$'\n";
	$decoded = decode_base64($');
	if ($decoded ne ":") {
#		print "$_\n";
		my @split = split(":",$decoded);
		$users{$split[0]} = $split[1];
	}
}
close FILE;

foreach (keys %users) {
	print "$_:$users{$_}\n";
}